/* PhotoBrowser */

#import <Cocoa/Cocoa.h>

#import "PhotoBase.h"

@class DirData;
@class PhotoViewer;
@class ThumbData;
@class ThumbnailView;


#define PREF_BROWSER_FRAME_RECT		@"Browser.frameRect"


@interface PhotoBrowser : PhotoBase
{
    IBOutlet NSOutlineView			*dirDataView;
    IBOutlet NSWindow				*mainWindow;
    IBOutlet NSProgressIndicator	*progressIndicator;
    IBOutlet NSSplitView			*splitView;
    IBOutlet NSTextField			*statusBar;
    IBOutlet ThumbnailView			*thumbView;


	BOOL			loadThreadRunning;
	BOOL			stopLoadThread;

	// This is the top-level directory in the browser - it shows all this directories children
	// in the left directory view.
	NSString		*topDir;

	// This is the currently selected directory; it'll be a child of topDir (not necessarily a
	// direct child, though).
	NSString		*curDir;
	DirData			*dirRoot;


	// The directory item that was selected prior to creating a new directory, which
	// is the one we'll re-select when the create is done.
	id				preCreateDirItem;

	// If YES/true, show folders starting with a '.' in the directory outline.
	BOOL			showDotFolders;


	int 			sortBy;
	BOOL			showName;
	BOOL			showDate;
	BOOL			showFileLength;
	BOOL			showImageSize;

	BOOL			regenMismatchedThumbs;

	BOOL			disableSelectNotification;
	int				savedOutlineWidth;
	int				savedThumbnailWidth;

	NSColor			*originalColor;
}

- (IBAction) createFolder:(id)sender;
- (IBAction) openImage:(id)sender;
- (IBAction) refresh:(id)sender;
- (IBAction) revealInFinder:(id)sender;
- (IBAction) selectAllImages:(id)sender;
- (IBAction) showDate:(id)sender;
- (IBAction) showFileSize:(id)sender;
- (IBAction) showImageSize:(id)sender;
- (IBAction) showName:(id)sender;
- (IBAction) sortByDates:(id)sender;
- (IBAction) sortByNames:(id)sender;
- (IBAction) sortByThumbStates:(id)sender;
- (IBAction) sortByTypes:(id)sender;
- (IBAction) toggleAutoShow:(id)sender;



- (NSWindow*) mainWindow;
- (NSSplitView*) splitView;

- (void) updateColors;

- (PhotoViewer*) openImageInViewer;

- (NSString*) currentFolder;
- (BOOL) hasDirectory;
- (BOOL) hasSelectedImage;
- (BOOL) hasSelectedJPEG;
- (int) sortBy;

- (void) loadDirectoryAndSelect: (NSString *) path  parentDir:(NSString*)parentDir;
- (void) loadDirectoryView: (NSString*) path;
- (void) setOutlineColumnWidth;
- (void) selectDirectoryViewPath:(NSString*) path;
- (void) loadThumbnails: (NSString *) path;
- (void) loadThumbnailsThread: (id) children;
- (void) loadThumbnailStarted:(id)fm;
- (void) updateStatusBar;


@end
